import { getBaseUrl } from '@/services/urlconst';
import { getLoadMapList, getSelectDataMapList, getTenantID, requestFunComponFiex } from '@/utils';
import { useCallback, useMemo } from 'react';
import { useRequest } from 'umi';

let baseUrl = getBaseUrl();

// 资产报废
const cancelService = (cancelCallback: (res: any) => void) => {
  const request = useRequest(
    (ids: any) => {
      let personUrl = `${baseUrl}/assetStuff/editAssetStuff`;
      const body = {
        ...ids,
        // isScrap: '1', // 报废
      };

      return requestFunComponFiex('POST', personUrl, body);
    },
    {
      manual: true,
      onSuccess: (res) => {
        cancelCallback(res);
      },
    },
  );
  return {
    cancelRun: request?.run,
    cancelLoading: request?.loading,
  };
};

export { cancelService };
